<?php
declare (strict_types=1);

namespace app\command;

use AlibabaCloud\Client\Resolver\ApiResolver;
use app\webapi\controller\APiRedisServer;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use think\facade\Db;

class scheduleTask extends Command
{
    protected function configure()
    {
        // 指令配置
        $this->setName('scheduletask')
            ->setDescription('抢购场次刷新任务 * 5分钟刷新');
    }

    protected function execute(Input $input, Output $output)
    {
        // 指令输出
        $output->writeln('抢购场次刷新任务 * 5分钟刷新');
        $data = Db::query("SELECT *,state schedule_state FROM sy_rush_schedule ORDER BY starttime ASC", []);
        APiRedisServer::selected(0)->set("rush_schedule", json_encode($data, JSON_UNESCAPED_UNICODE));

    }
}
